using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;

namespace OpenFlashChartLib
{
    public class OpenFlashChartControlHandler : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            string uniqControlID = context.Request.Params[OpenFlashSettings.HandlerGetControlParam];
            if (uniqControlID != null)
            {
                Graph gr = (Graph) context.Cache[uniqControlID];
                if (gr != null)
                {
                    using (HtmlTextWriter writer = new HtmlTextWriter(context.Response.Output))
                    {
                        gr.RenderControl(writer);
                    }
                }
            }
        }

        public bool IsReusable
        {
            get { return true; }
        }
    }
}
